<div class="row">
 <div class="span3 bs-docs-sidebar ">
 	<*include file="<*$controller*>/location.tpl"*>
  </div>
  <*if $_user->username eq 'admin'*>

  <div class="span8">
<table class="table">
<tr>
<th>用户名</th>
<th>最后登录时间</th>
<th>登录次数</th>
<th>&nbsp;</th>
<th>&nbsp;</th>
</tr>
   <*foreach from=$result item=item key=key*>
   <tr>
   <td><*$item.username*></td>
   <td><*$item.lasttime*></td>
   <td><*$item.login_num*></td>
    <td>
<button type="button" class="btn  btn-small" onclick="javascript:setup(<*$item.id*>)"><i class="icon-wrench"></i> 设置权限</button>&nbsp;&nbsp;&nbsp;&nbsp;
  <*if $item.id neq '3'*>
<button type="button" class="btn  btn-small" onclick="javascript:deleteit(<*$item.id*>)"><i class="icon-remove"></i> 删除</button>
  
&nbsp;&nbsp;&nbsp;&nbsp;<!--<button type="button" class="btn  btn-small"><i class="icon-lock"></i> 锁定</button>-->
<a   role="button" class="btn" data-toggle="modal" onclick="javascript:resetpassword(<*$item.id*>)"><i class="icon-pencil"> </i> 初始化密码</a><*/if*>
	</td>
  <td>&nbsp;</td>
   </tr>
  <*/foreach*>
</table>
<div  class="control-group form-actions">
<a href="#myModal" role="button" class="btn btn-primary" data-toggle="modal"><i class="icon-user icon-white"></i> 新增管理员</a>
</div>
</div>
</div>
<!-- Modal -->
<div id="myModal" class="modal hide fade" tabindex="-1" role="dialog" aria-labelledby="myModalLabel" aria-hidden="true">
      <form class="form-signin" id="login_form" action="/<*$controller*>/opadd" method="post" onsubmit="return checkLoginForm();">

  <div class="modal-header">
    <button type="button" class="close" data-dismiss="modal" aria-hidden="true">×</button>
    <h3 id="myModalLabel">新增管理员</h3>
  </div>
  <div class="row">
  <div class="modal-body span3">
        <label class="control-label pull-left" >帐号</label><input type="text" class="input-block-level" autocomplete="off" placeholder="输入账号"  id="account" name="account" >
        <label class="control-label pull-left" >昵称</label><input type="text" class="input-block-level" autocomplete="off" placeholder="输入昵称"  id="nickname" name="nickname" >
         <label class="control-label" >密码</label><input type="password" class="input-block-level" placeholder="输入密码" id="password" name="password" >
        <label class="control-label" >再次输入密码</label> <input type="password" class="input-block-level" placeholder="再次输入密码" id="repassword" name="repassword" >
		 <!--<label class="control-label" >权限</label>-->	

    
  </div>
  </div>
  <div class="modal-footer">
    <button class="btn" data-dismiss="modal" aria-hidden="true">关闭</button>
    <button class="btn btn-primary" type="submit">保存</button>
  </div>
        </form>
<script type="text/javascript" >
function checkLoginForm(){
	var account=document.getElementById('account').value;
	var nickname=document.getElementById('nickname').value;
	var password=document.getElementById('password').value;
	var repassword=document.getElementById('repassword').value;
	if(''== account){
		alert('需要输入账号');
		document.getElementById("account").focus();
		return false;
	}
	if(''== nickname){
		alert('需要输入昵称');
		document.getElementById("nickname").focus();
		return false;
	}
	if(''== password){
		alert('需要输入密码');
		document.getElementById("password").focus();
		return false;
	}
	if(repassword != password){
		alert('两次密码不一致');
		document.getElementById("repassword").focus();
		return false;
	}

	return true;
}

function deleteit(id)
{
  if(confirm("删除将不能恢复")){
   window.location='/<*$controller*>/delete/id/'+id;
  }
}
function resetpassword(id)
{ 
   window.location='/<*$controller*>/resetcentralpassword/id/'+id;
}
function setup(id)
{ 
   window.location='/<*$controller*>/setup/id/'+id;
}
</script>
<*/if*>
</div>